import Vue from 'vue'
import VueRouter from 'vue-router'
import 'nprogress/nprogress.css'
import Layout from '@/layout'

Vue.use(VueRouter)


/**
 *  静态路由
 */
export const constantRoutes = [
  {
    path: '',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "about" */ '@/views/login/index')
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/wel/index', 
        name: '首页',
        component: () => import('@/views/dashboard/index.vue')
      },
    ]
  },
  { 
    path: '',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '/proxy/api/:detail',
        name: '路由详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/proxy_api/form/ProxyDetail.vue')
      },
      {
        path: '/gateway/group/:detail',
        name: '网关分组详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/gateway_group/detail/GroupDetail.vue')
      },
      {
        path: '/callback/detail/:detail',
        name: '回调详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/callback_config/CallbackDetail.vue')
      },
      {
        path: '/gateway/dictHistory',
        name: '公共资源历史',
        component: () => import(/* webpackChunkName: "about" */ '@/views/gateway_dict/history/GatewayHistory.vue')
      },
      // 我的申请详情
      {
        path: '/aggregateRecord/applyDetail',
        name: '申请详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/aggregateRecord_apply/applyDetail.vue')
      },
      // 接口详情
      {
        path: 'aggregate/api/:add',
        name: '接口详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/aggregate_api/detail/ApiDetail.vue')
      },
      // 文档集
      {
        path: 'interface/collection/:add',
        name: '文档详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/interface_collection/form/CollectionDetail.vue')
      },
      // 接口文档详情
      {
        path: 'interface/document/:add',
        name: '接口文档详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/document/detail/DocumentDetail.vue')
      },
      // 业务专线详情
      {
        path: 'public-network/business/:add',
        name: '专线业务详情',
        component: () => import(/* webpackChunkName: "about" */ '@/views/publicNetwork_business/detail/BusinessDetail.vue')
      },
      {
        path: '/info/index',
        name: '个人信息',
        component: () => import(/* webpackChunkName: "about" */ '@/views/userinfo')
      },
    ]
  },
];

/**
 * 动态路由
 */
export const asyncRouterMap = []
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes:constantRoutes
})

export default router
